package com.wx.ctrl;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.sevenchildren.framework.entity.Entry;
import com.sevenchildren.framework.util.http.HttpUtils;

@Controller
@RequestMapping("/onLogin")
public class XiaocxCtrl {

	@Resource
	HttpUtils httpUtils;

	@RequestMapping
	@ResponseBody
	public Object query(HttpServletRequest request, HttpServletResponse response, String code) {
		System.out.println(code);
		String url = "https://api.weixin.qq.com/sns/jscode2session?appid=wxe9261d0877d1c5d5&secret=f456453bd506e85475f739b844cb0a00&js_code=" + code + "&grant_type=authorization_code";
		Entry<String, String> e = httpUtils.poolGet(url, null);
		return e;
	}

}
